//
//  SJXQHeaderView.m
//  SanYiTeaching
//
//  Created by 李文强 on 2019/4/11.
//  Copyright © 2019 李文强. All rights reserved.
//

#import "SJXQHeaderView.h"

@implementation SJXQHeaderView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
- (instancetype)initWithFrame:(CGRect)frame{
    if ([super initWithFrame:frame]) {
        [self initSubView];
    }
    return self;
}
- (void)initSubView{
    self.backgroundColor = [UIColor whiteColor];
    [self addSubview:self.titleLabel];
    [self addSubview:self.mentorLabel];
    [self addSubview:self.detailLabel];
    [self addSubview:self.timeLabel];
    [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@40);
        make.top.equalTo(@15);
        make.right.equalTo(self.mas_centerX);
        make.height.equalTo(@14);
    }];
    [_mentorLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_centerX);
        make.top.equalTo(@15);
        make.right.equalTo(@0).offset(-40);
        make.height.equalTo(@14);
    }];
    [_detailLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.titleLabel.mas_left);
        make.top.equalTo(self.titleLabel.mas_bottom).offset(10);
        make.right.equalTo(self.mas_centerX);
        make.height.equalTo(@14);
    }];
    [_timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_centerX);
        make.top.equalTo(self.titleLabel.mas_bottom).offset(10);
        make.right.equalTo(@0).offset(-40);
        make.height.equalTo(@14);
    }];
    UIView *lineView = [[UIView alloc]init];
    lineView.backgroundColor  = [UIColorChange colorwithHexString:@"#CCCCCC"];
    [self addSubview:lineView];
    [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@0);
        make.right.equalTo(@0);
        make.bottom.equalTo(self.mas_bottom).offset(-1);
        make.height.equalTo(@1);
    }];
}
- (UILabel *)titleLabel{
    if (!_titleLabel) {
        UILabel *label = [[UILabel alloc]init];
        label.frame = CGRectMake(330,79.5,166,13.5);
        label.numberOfLines = 0;
        label.textColor = [UIColor colorWithRed:102/255.0 green:102/255.0 blue:102/255.0 alpha:1.0];
        label.font = [UIFont systemFontOfSize:12];
        _titleLabel = label;
    }
    return _titleLabel;
}
- (UILabel *)mentorLabel{
    if (!_mentorLabel) {
        UILabel *label = [[UILabel alloc] init];
        label.frame = CGRectMake(616,79,101.5,11.5);
        label.numberOfLines = 0;
        label.textColor = [UIColor colorWithRed:102/255.0 green:102/255.0 blue:102/255.0 alpha:1.0];
        label.font = [UIFont systemFontOfSize:12];
        _mentorLabel = label;
    }
    return _mentorLabel;
}
- (UILabel *)detailLabel{
    if (!_detailLabel) {
        UILabel *label = [[UILabel alloc] init];
        label.frame = CGRectMake(330,103,132,11.5);
        label.numberOfLines = 0;
        label.textColor = [UIColor colorWithRed:102/255.0 green:102/255.0 blue:102/255.0 alpha:1.0];
        label.font = [UIFont systemFontOfSize:12];
        _detailLabel = label;
    }
    return _detailLabel;
}
- (UILabel *)timeLabel{
    if (!_timeLabel) {
        UILabel *label = [[UILabel alloc] init];
        label.frame = CGRectMake(616,105.5,153.5,9);
        label.numberOfLines = 0;
        label.textColor = [UIColor colorWithRed:102/255.0 green:102/255.0 blue:102/255.0 alpha:1.0];
        label.font = [UIFont systemFontOfSize:12];
        _timeLabel = label;
    }
    return _timeLabel;
}
@end
